/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package es.aurea.presentation.datas;

import java.util.List;

/**
 *
 * @author zarius
 */
public class AccountingDt{

    private AccountingTable selected = null;

    private List<AccountingTable> accounts = null;

    private boolean modalRendered=false;

    public boolean getModalRendered() {
        return modalRendered;
    }

    public void setModalRendered(boolean modalRendered) {
        this.modalRendered = modalRendered;
    }

    public List<AccountingTable> getAccounts() {
        return accounts;
    }

    public void setAccounts(List<AccountingTable> accounts) {
        this.accounts = accounts;
    }

    public List<AccountingTable> getRows() {
        return accounts;
    }

    public AccountingTable getSelected() {
        return selected;
    }

    public void setSelected(AccountingTable selected) {
        this.selected = selected;
    }

    public int getIndexOfSelected(AccountingTable id){
        return getAccounts().indexOf(id)+1;
    }

    public AccountingTable getAccountingTable(Integer id){
        
        for (AccountingTable at : getAccounts()){
            if (at.getId().equals(id)){
                return at;
            }
        }

        return null;
    }

    public void setShowed(Integer id, boolean showed){
        for (AccountingTable at : getAccounts()){
            if (at.getId().equals(id)){
                at.setShowed(showed);
            }
        }
    }
}
